import echarts from 'echarts/lib/echarts';
import 'echarts/map/js/china';
import 'echarts/map/js/province/shandong';
// import 'echarts/map/js/china';
//  地图数据
const mapData = {
  citys: [
    {
      name: '济南',
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
      value: [117.11629963283451,
        36.64820756107136]
    },
    {
      name: '滕州',
      value: [
        117.18614319,
        35.10728545
      , 1],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '禹城',
      value: [116.6348,36.9426, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '招远',
      value: [120.4381,	37.3677, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '汶上',
      value: [116.4933,35.72477, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '曲阜',
      value: [116.9900,	35.5897, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '金乡',
      value: [	116.3149,	35.0771, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '乐陵',
      value: [117.2098,		37.7303, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
    {
      name: '临朐',
      value: [118.5450,	36.5142, 2],
      symbolSize: 2,
      itemStyle: {
        normal: {
          color: '#F58158',
        },
      },
    },
  ]
};

export const mapOptions = (params) => ({
  title: {
    show: false,
    text: '全国输送图',
    left: 'center',
    textStyle: {
      color: '#fff',
    },
  },
  legend: {
    show: false,
  },
  geo: {
    // nameMap: {
    //   China: '中国',
    // },
    map: '山东',
    // roam: true,
    label: {
      emphasis: {
        show: false,
      },
    },
    zoom: 1.2,
    itemStyle: {
      normal: {
        borderColor: 'rgba(255,209,163, .5)', //区域边框颜色
        areaColor: 'rgba(73,86,166,.1)', //区域颜色
        borderWidth: 0.5, //区域边框宽度
        shadowBlur: 5,
        shadowColor: 'rgba(107,91,237,.7)',
      },
      emphasis: {
        borderColor: '#FFD1A3',
        areaColor: 'rgba(102,105,240,.3)',
        borderWidth: 1,
        shadowBlur: 5,
        shadowColor: 'rgba(135,138,255,.5)',
      },
    },
  },
  series: [
    {
      name: '地点',
      type: 'effectScatter',
      coordinateSystem: 'geo',

      zlevel: 2,
      rippleEffect: {
        brushType: 'stroke',
      },
      label: {
        show: true,
        formatter: '{b}',
      },
      symbolSize: 2,
      showEffectOn: 'render',
      itemStyle: {
        normal: {
          color: '#46bee9',
        },
      },
      data: mapData.citys,
    },
    {
      name: '线路',
      type: 'lines',
      coordinateSystem: 'geo',
      zlevel: 2,
      zoom: 1,
      large: true,
      effect: {
        show: true,
        constantSpeed: 30,
        symbol: 'pin',
        symbolSize: 3,
        trailLength: 0,
      },
      lineStyle: {
        normal: {
          color: new echarts.graphic.LinearGradient(
            0,
            0,
            0,
            1,
            [
              {
                offset: 0,
                color: '#58B3CC',
              },
              {
                offset: 1,
                color: '#F58158',
              },
            ],
            false
          ),
          width: 2,
          // opacity: 0.2,
          curveness: 0.1,
        },
      },
      data: params.moveLines,
    },
  ],
});
